package thread;

public class Demo6 {
    public static void main(String[] args) {
        Thread t1 = new Thread((Runnable) () -> {
           while (true) {
               System.out.println("Hello World");
               try {
                   Thread.sleep(100);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        },"这是新线程");

        //设置t1为后台线程
        t1.setDaemon(true);

        t1.start();
    }
}
